<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Switch 语句</title>
</head>

<body>
    <p id="demo"></p>

    <script>
        var day;
        switch (new Date().getDay()) {
            case 0:
                day = "周日";
                break;
            case 1:
                day = "周一";
                break;
            case 2:
                day = "周二";
                break;
            case 3:
                day = "周三";
                break;
            case 4:
                day = "周四";
                break;
            case 5:
                day = "周五";
                break;
            case 6:
                day = "周六";
        }
        document.getElementById("demo").innerHTML = "今天是" + day;
    </script>
</body>

</html>